import { createSlice, PayloadAction } from '@reduxjs/toolkit'

/* MenuState */
export interface MenuState {
	isCollapse: boolean;
	menuList: Menu.MenuOptions[];
}

const initialState: MenuState = {
  isCollapse: false,
	menuList: []
};


export const globalSlice = createSlice({
  name: 'global',
  initialState,
  reducers: {
    updateCollapse: (state, action: PayloadAction<boolean>) => {
      state.isCollapse = action.payload
    },
    setMenuList: (state, action: PayloadAction<Menu.MenuOptions[]>) => {
      state.menuList = action.payload
    },    
  },
})

export const { updateCollapse,setMenuList } = globalSlice.actions

export default globalSlice.reducer